<table id="${showReportGridId}" data-options="border:false"></table>
${searchHtml!}
<script type="text/javascript">
	//表格查询  
	function reloadConfig${configId}() {
		$('#${showReportGridId}').datagrid('reload'); //设置好查询参数 reload 一下就可以了  
	    $('#${showReportGridId}').datagrid('unselectAll');
	    $('#${showReportGridId}').datagrid('uncheckAll');
	}
	function reportSearch${configId}() {
		setConfigReportSearchParams${configId}(false);
		reloadConfig${configId}();
	}
	
	function moreReportSearch${configId}(btn) {
		$('.hiddenSearchTr${configId}').toggle();
		printLog($(".hiddenSearchTr${configId}").is(":hidden"));
		if(!$(".hiddenSearchTr${configId}").is(":hidden")) {
			$('#moreSearchBtn${configId} .l-btn-left span.l-btn-icon').removeClass('layout-button-down');
			$('#moreSearchBtn${configId} .l-btn-left span.l-btn-icon').addClass('layout-button-up');
			$('#moreSearchBtn${configId} .l-btn-left .l-btn-text').html('收起');
		} else {
			$('#moreSearchBtn${configId} .l-btn-left span.l-btn-icon').removeClass('layout-button-up');
			$('#moreSearchBtn${configId} .l-btn-left span.l-btn-icon').addClass('layout-button-down');
			$('#moreSearchBtn${configId} .l-btn-left .l-btn-text').html('更多');
		}
	}
	
	function clearConfigReportSearch${configId}() {
		$('#reportSearchForm${configId}').form('clear');
		setConfigReportSearchParams${configId}(true);
		reportSearch${configId}();
	}
	//设置查询参数或清空查询参数
	function setConfigReportSearchParams${configId}(isClear) {
// 		var fields = $('#reportSearchForm${configId}').serialize();
		//$('#reportSearchForm${configId}').serializeArray(); //自动序列化表单元素为JSON对象  
// 		printLog($('#reportSearchForm${configId}').serializeArray());
// 		printLog($('#reportSearchForm${configId}').serialize());

		var formParams = $('#reportSearchForm${configId}').form("getData");
		printLog(formParams);
		var params = $('#${showReportGridId}').datagrid('options').queryParams; //先取得 datagrid 的查询参数  
// 	    $.each(fields, function(i, field){ 
// 	    	if(isClear) {
// 	    		delete params[field.name];
// 	    	}else {
// 	    		params[field.name] = field.value; //设置查询参数
// 	    	}
// 	    });
// 		var fieldArray= new Array();
// 		fieldArray=fields.split("&");
// 		for (i=0;i<fieldArray.length ;i++ )   
// 	    {   
// 			var tempField = fieldArray[i].split("=");
// 			params[tempField[0]] = tempField[1]; //设置查询参数;   
// 	    }   
// 	    printLog(params);
		 $.extend(params, formParams);
		 printLog(params);
	}
	function exportReport${configId}() {
	    var options = $('#${showReportGridId}').datagrid('getPager').data("pagination").options;
		var curr = options.pageNumber;
		var total = options.total;
		printLog(curr+'----'+total);
		createFromWindowOptions({
			title:"导出报表",
			maximizable:false,
			width:400,
			height:200,
			href:"readReport.do?exportWin&configId=" + ${configId}+"&totalRecord="+total,
			callback:function(data) {
				exportReportFormAction('${showReportGridId}');
			},
			enableSaveButton:true
		});
	}
	
	function chartReport${configId}() {
			createFromWindowOptions({
				title:"图表显示",
				maximizable:false,
				width:600,
				height:500,
				href:"readReport.do?chartWin&configId=" +${configId},
				callback:function(data) {
					
				},
				enableSaveButton:false
			});
	}
	
	$('#${showReportGridId}').datagrid({
		url:'readReport.do?loadConfigReportData',
		height:'auto',
		striped:'false',
		checkbox:true,
		fit:true,
		selectOnCheck:false,
		checkOnSelect:false,
// 		toolbar:'#configlist_search',
		loadMsg:'数据加载中，请稍等...',
		queryParams:{time : new Date().getTime(),reportId:${(configItem.id)!}},
		rownumbers:true,
		singleSelect:true,
		idField:'id',
		pageSize: 30,
		pageList:[10, 30, 50, 100],
		pagination:true,
		columns:[${columns!}],
		toolbar:'#${searchId!}'
	});
	$('#${showReportGridId}').datagrid('getPager').pagination(
			{beforePageText: '第',
			afterPageText: '页    共 {pages} 页',
			displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',});
</script>


